package thread.processing;
import static java.lang.System.out;

/**
 * add your own  start() and stop() methods for convenience
 * @author srashid
 *
 */
public class Ping2 implements Runnable {
	
	volatile Thread This_Thread = null;
	int delay = 0;
	
	Ping2(int delay) {
		this.delay = delay;
		out.println("Sleep time of Ping = " + delay);
	}
	public void start(){
    	if(This_Thread == null ) {
      		This_Thread = new Thread(this);
      		This_Thread.start();
    	}
  	}
	
	public void run() {
		try {
			for (int count = 1; count < 10; count++) {
				out.printf("%s%d\t","Ping",count);
				Thread.sleep(delay);
			}
		} catch (InterruptedException e) {
			out.println(e);
		}
	}
}
